<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="zh">
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>设备出入库列表</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="static/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="static/ajax/libs/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="static/css/animate.css" rel="stylesheet"/>
    <link href="static/css/style.css" rel="stylesheet"/>
    <link href="static/ruoyi/css/ry-ui.css" rel="stylesheet"/>


    <link href="static/ajax/libs/jquery-layout/jquery.layout-latest.css" rel="stylesheet"/>


    <link href="static/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css" rel="stylesheet"/>

</head>
<body class="gray-bg">

<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="user-form" action="searchDevice.do" method="get">
                    <div class="select-list">
                        <ul>
                            <li>
                                设备名称：<input type="text" name="1" required pattern="[\u4e00-\u9fa5]+"/>
                            </li>

                            <li class="select-time">
                                <label>入库时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                       name="2"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                       name="3"/>
                            </li>
                            <li>
                                <button type="submit" class="btn btn-white" data-dismiss="modal">搜索</button>
                                <button type="submit" class="btn btn-primary">重置</button>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>


            <div class="col-sm-12 select-table table-striped">
                <div class="bootstrap-table">
                    <div class="fixed-table-toolbar">
                        <div class="bs-bars pull-left">
                            <div class="btn-group-sm" id="toolbar" role="group">
                                <button class="btn btn-info" data-toggle="modal" data-target="#myModal" >
                                    <i class="fa fa-upload"></i> 入库登记
                                </button>
                                <button class="btn btn-info" data-toggle="modal" data-target="#myModal2" >
                                    <i class="fa fa-upload"></i> 出库登记
                                </button>
                                <button class="btn btn-info" data-toggle="modal" data-target="#myModal3" >
                                    <i class="fa fa-download"></i> 导出
                                </button>
                            </div>
                        </div>
                        <div class="bs-bars pull-right">
                            <li>
                                <select class="form-control">
                                    <option value="0">入库</option>
                                    <option value="1">出库</option>
                                </select>
                            </li>
                        </div>
                    </div>
                    <div class="fixed-table-container" style="padding-bottom: 0px;">
                        <div class="fixed-table-header" style="display: none;">
                            <table></table>
                        </div>
                        <div class="fixed-table-body">
                            <div class="fixed-table-loading" style="top: 41px; display: none;">正在努力地加载数据中，请稍候……</div>

                            <table id="bootstrap-table" data-mobile-responsive="true" class="table table-hover">
                                <thead>
                                <tr>
                                    <th class="bs-checkbox " style="width: 36px;">
                                        <div class="th-inner ">
                                            <input name="btSelectAll" type="checkbox">
                                        </div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">设备编号</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner sortable both">设备名称</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">出入库时间</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">出入库</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">出入库人员</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">购买批次</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">操作</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                </tr>
                                </thead>

                                <tbody>
                                <c:forEach items="${putAndDeliveryVOs.list }" var="putAndDeliveryVO">
                                	<tr data-index="0">
	                                    <td class="bs-checkbox ">
	                                        <input data-index="0" name="btSelectItem" type="checkbox">
	                                    </td>
	                                    <td>${putAndDeliveryVO.batch }</td>
	                                    <td>${putAndDeliveryVO.name }</td>
	                                    <td>${putAndDeliveryVO.pdTime }</td>
	                                    <c:if test="${putAndDeliveryVO.pdType == 1 }">
	                                    	<td>入库</td>
	                                    </c:if>
	                                    <c:if test="${putAndDeliveryVO.pdType == 0 }">
	                                    	<td>出库</td>
	                                    </c:if>
	                                    <td>${putAndDeliveryVO.user.name }</td>
	                                    <td>${putAndDeliveryVO.buyBatch }</td>
	                                    <td>
	                                        <a class="btn btn-info btn-xs device_detail" href="javascript:void(0)" data-id="${putAndDeliveryVO.batch }">
	                                            <i class="fa fa-key"></i>详情
	                                        </a>
	                                    </td>
	                                </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                        <div class="fixed-table-footer" style="display: none;">
                            <table>
                                <tbody>
                                <tr></tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="fixed-table-pagination" style="display: block;">
                            <div class="pull-left pagination-detail">
                                <span class="pagination-info">第${putAndDeliveryVOs.pageNum }页，共${putAndDeliveryVOs.pages + 1}页，共  ${putAndDeliveryVOs.total } 条记录。</span>
                            </div>
                            <div class="pull-right pagination">
                                <ul class="pagination pagination-outline">
                                    <c:choose>
									    <c:when test="${putAndDeliveryVOs.pageNum == 1 }"> 
									   		<li class="page-pre active">
		                                    	<a href="javascript:void(0)">‹</a>
		                                    </li>
									   	</c:when>
									   	<c:otherwise>
									   		<li class="page-pre">
		                                    	<a href="${basePath }/toTea.do?pagenum=${putAndDeliveryVOs.pageNum - 1 }">‹</a>
		                                    </li>
									   	</c:otherwise>
									</c:choose>
                                    
                                    <c:forEach items="${putAndDeliveryVOs.navigateNums }" var="num">
                                    	<c:if test="${putAndDeliveryVOs.pageNum == num }">
                                    		<li class="page-number active">
                                    			<a href="javascript:void(0)">${num }</a>
                                    		</li>
                                    	</c:if>
                                    	<c:if test="${putAndDeliveryVOs.pageNum != num }">
                                    		<li class="page-number">
                                    			<a href="${basePath }/toTea.do?pagenum=${num }">${num }</a>
                                    		</li>
                                    	</c:if>
                                    </c:forEach>
                                    <c:if test="${putAndDeliveryVOs.pageNum == putAndDeliveryVOs.pages+1 }">
	                                    <li class="page-next active">
	                                    	<a href="javascript:void(0)">›</a>
	                                    </li>
                                    </c:if>
                                    <c:if test="${putAndDeliveryVOs.pageNum < putAndDeliveryVOs.pages }">
	                                    <li class="page-next">
	                                    	<a href="${basePath }/toTea.do?pagenum=${putAndDeliveryVOs.pageNum + 1 }">›</a>
	                                    </li>
                                    </c:if>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>


        </div>
    </div>
</div>

<div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span>
                </button>
                <i class="fa fa-laptop modal-icon"></i>
                <h4 class="modal-title">入库登记</h4>
            </div><small class="font-bold">
            <div class="modal-body">
                <div class="modal-body">
                  <form action="devicePut.do" method="post">
                  	<div class="form-group">
                      <label for="recipient-name" class="control-label">采购批次：</label>
                      <input type="text" name="buyBatch" class="form-control" required pattern="\w[0-9]{10}">
                    </div>
                   	<!-- <div class="form-group">
                      <label for="recipient-name" class="control-label">设备编号：</label>
                      <input type="text" name="deviceId" class="form-control" required pattern="\w[0-9]{10}">
                    </div> -->
                    <div class="form-group">
                      <label for="message-text" class="control-label">设备型号：</label>
                      <select class="form-control" name="deviceModel">
                        <c:forEach items="${deviceModels }" var="deviceModel">
                        	<option value="${deviceModel.id }" > ${deviceModel.id }</option>
                        </c:forEach>
                      </select>
                    </div>
                    <div class="form-group">
                      <label for="message-text" class="control-label">设备名：</label>
                      <input type="text" name="deviceName" class="form-control" required pattern="[\u4e00-\u9fa5]+">
                    </div>
                     <div class="form-group">
                      <label for="message-text" class="control-label">状态：</label>
                      <select class="form-control" name="status">
                        <option value="1">正常</option>
                        <option value="-1">异常</option>
                        <option value="0">报废</option>
                      </select>
                    </div>
                    <div class="form-group">
                      <label for="message-text" class="control-label">购买金额：</label>
                      <input class="form-control" name="price"  required pattern="^(([1-9]\d*)|0)(\.\d{1-2})?$" />
                    </div>
                    <div class="form-group">
                      <label for="message-text" class="control-label">供应商负责人：</label>
                      <select class="form-control" name="supplierId">
                      	<c:forEach items="${suppliers }" var="supplier">
                       		<option value="${supplier.id }">${supplier.supplier }</option>
                       	</c:forEach>
                      </select>
                    </div>
                    <input type="hidden" name="isPut" value="1" />
                    <input type="hidden" name="userId" value="${user.userId }" />
                    <div class="modal-footer">
		                <button type="submit" class="btn btn-white" data-dismiss="modal">关闭</button>
		                <button type="submit" class="btn btn-primary">保存</button>
		            </div>
                  </form>
                </div>
            </div>
            
        </small></div><small class="font-bold">
    </small></div><small class="font-bold">
</small></div>


<div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span>
                </button>
                <i class="fa fa-laptop modal-icon"></i>
                <h4 class="modal-title">出库登记</h4>
            </div><small class="font-bold">
            <div class="modal-body">
                <div class="modal-body">
                  <form action="deviceDelivery.do" method="post">
                    <!-- <div class="form-group">
                      <label for="recipient-name" class="control-label">设备名称：</label>
                      <select class="form-control" name="deviceName">
                        <option>杀青</option>
                        <option>揉捻</option>
                        <option>干燥</option>
                        <option>打包</option>
                        <option>输送</option>
                      </select>
                    </div> -->
                    <div class="form-group">
                      <label for="recipient-name" class="control-label">设备编号：</label>
                      <select class="form-control" name="deviceId">
                        <c:forEach items="${devicePuts }" var="devicePut">
                        	<option value="${devicePut }">${devicePut }</option>
                        </c:forEach>
                      </select>
                    </div>
                    <input type="hidden" name="userId" value="${user.userId }">
                     <div class="modal-footer">
		                <button type="submit" class="btn btn-white" data-dismiss="modal">关闭</button>
		                <button type="submit" class="btn btn-primary">点击出库</button>
		            </div>
                  </form>
                </div>
            </div>
           
        </small></div><small class="font-bold">
    </small></div><small class="font-bold">
</small></div>

<div class="modal inmodal" id="myModal3" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span>
                </button>
                <i class="fa fa-laptop modal-icon"></i>
                <h4 class="modal-title">记录导出</h4>
            </div><small class="font-bold">
            <div class="modal-body">
                <div class="modal-body">
                  <form action="exportDevice.do" method="get">
                    <div class="form-group">
                      <label for="recipient-name" class="control-label">选择类型</label>
                      <select class="form-control" name="1">
                        <option value="1">入库</option>
                        <option value="0">出库</option>
                      </select>
                    </div>
                    <div class="form-group">
                      <label for="recipient-name" class="control-label">选择日期</label>
                      <div class="row">
                        <div class='col-sm-4'>
                            <div class="form-group">
                                <input type="text" class="time-input form-control" id="startTime" placeholder="开始时间"
                                       name="2"/>
                            </div>
                        </div>
                        <div class='col-sm-4'>
                            <div class="form-group">
                                 <input type="text" class="time-input form-control" id="endTime" placeholder="结束时间"
                                       name="3"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                <button type="submit" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="submit" class="btn btn-primary">点击导出</button>
            </div>
                  </form>
                </div>
            </div>
            
        </small></div><small class="font-bold">
    </small></div><small class="font-bold">
</small></div>


<script src="static/js/jquery.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
<!-- bootstrap-table 表格插件 -->
<script src="static/ajax/libs/bootstrap-table/bootstrap-table.min.js"></script>
<script src="static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js"></script>
<script src="static/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js"></script>
<script src="static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="static/ajax/libs/validate/jquery.validate.min.js"></script>
<script src="static/ajax/libs/validate/messages_zh.min.js"></script>
<script src="static/ajax/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
<!-- jquery-export 表格导出插件 -->
<script src="static/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js"></script>
<script src="static/ajax/libs/bootstrap-table/extensions/export/tableExport.js"></script>
<!-- 遮罩层 -->
<script src="static/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="static/ajax/libs/iCheck/icheck.min.js"></script>
<script src="static/ajax/libs/layer/layer.min.js"></script>
<script src="static/ajax/libs/layui/layui.js"></script>
<script src="static/ruoyi/js/common.js?v=4.0.0"></script>
<script src="static/ruoyi/js/ry-ui.js?v=4.0.0"></script>
<script> var ctx = "\/"; </script>


<script src="static/ajax/libs/jquery-layout/jquery.layout-latest.js"></script>


<script src="static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js"></script>

<script>

$(".device_detail").click(function () {
	let deviceId = $(this).attr("data-id");  	
	
	var url = "deviceDetail.do?deviceId="+deviceId; 
    $.modal.open("设备详情", url);
});
    
</script>
</body>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据
                &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i
                    class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>